class TransportPackagesController < ApplicationController
  # GET /transport_packages
  # GET /transport_packages.json
  def index
    @transport_packages = TransportPackage.where('transport_id = ?', params[:tsid])

    respond_to do |format|
      format.js { render layout: false }
    end
  end

  # GET /transport_packages/1
  # GET /transport_packages/1.json
  def show
    @transport_package = TransportPackage.find(params[:id])

    respond_to do |format|
      format.js { render layout: false }
    end
  end

  # GET /transport_packages/new
  # GET /transport_packages/new.json
  def new
    @transport_package = TransportPackage.new

    respond_to do |format|
      format.js { render layout: false }
    end
  end

  # GET /transport_packages/1/edit
  def edit
    @transport_package = TransportPackage.find(params[:id])
  end

  # POST /transport_packages
  # POST /transport_packages.json
  def create
    @transport_package = TransportPackage.new(params[:transport_package])
    @transport_package.save
    @transport_packages = TransportPackage.where('transport_id = ?', params[:tsid])

    respond_to do |format|
      format.js { render layout: false }
    end
  end

  # PUT /transport_packages/1
  # PUT /transport_packages/1.json
  def update
    @transport_package = TransportPackage.find(params[:id])
    @transport_package.update_attributes(params[:transport_package])
    @transport_packages = TransportPackage.where('transport_id = ?', params[:tsid])
    
    respond_to do |format|
      format.js { render layout: false }
    end
  end

  # DELETE /transport_packages/1
  # DELETE /transport_packages/1.json
  def destroy
    @transport_package = TransportPackage.find(params[:id])
    @tsid = @transport_package.transport_id
    @transport_package.destroy
    @transport_packages = TransportPackage.where('transport_id = ?', @tsid)

    respond_to do |format|
      format.js { render layout: false }
    end
  end
end
